package org.zjt.ds;

/**
 * @author juntao.zhang
 * @version V1.0
 * @Description: TODO
 * @Package org.zjt.ds
 * @date 2018/4/23 23:12
 */
public class MethodFinalTest {

    public static int  method() {
        int i = 0;
        try {
            i++;
            return i;
        }finally {
            System.err.println("return 后执行。finally");
            i++;
            System.err.println(i);
        }
    }


    /**
     * method1 和 method2是可重入的
     */
    public static synchronized void method1() {
        System.err.println("----------method1------------------------");
    }

    public static synchronized void method2() {
        System.err.println("----------method2------------------------");
    }



    public static void main(String[] args) {
        method1();
        method2();

        System.out.println(method());
    }
}
